/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lnngu_000
 */
@Entity
@Table(name = "Caterer")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Caterer.findAll", query = "SELECT c FROM Caterer c"),
    @NamedQuery(name = "Caterer.findByCatererId", query = "SELECT c FROM Caterer c WHERE c.catererId = :catererId"),
    @NamedQuery(name = "Caterer.findByFullname", query = "SELECT c FROM Caterer c WHERE c.fullname = :fullname"),
    @NamedQuery(name = "Caterer.findByEmail", query = "SELECT c FROM Caterer c WHERE c.email = :email"),
    @NamedQuery(name = "Caterer.findByUserId", query = "SELECT c FROM Caterer c WHERE c.userId = :userId"),
    @NamedQuery(name = "Caterer.findByPassword", query = "SELECT c FROM Caterer c WHERE c.password = :password"),
    @NamedQuery(name = "Caterer.findByIsActive", query = "SELECT c FROM Caterer c WHERE c.isActive = :isActive"),
    @NamedQuery(name = "Caterer.findByDescriptions", query = "SELECT c FROM Caterer c WHERE c.descriptions = :descriptions")})
public class Caterer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "catererId")
    private Integer catererId;
    @Size(max = 200)
    @Column(name = "fullname")
    private String fullname;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Size(max = 300)
    @Column(name = "email")
    private String email;
    @Size(max = 100)
    @Column(name = "userId")
    private String userId;
    @Size(max = 50)
    @Column(name = "password")
    private String password;
    @Column(name = "isActive")
    private Boolean isActive;
    @Size(max = 2147483647)
    @Column(name = "descriptions")
    private String descriptions;
    @OneToMany(mappedBy = "catererId")
    private Collection<Favorite> favoriteCollection;
    @OneToMany(mappedBy = "catererId")
    private Collection<Restaurant> restaurantCollection;

    public Caterer() {
    }

    public Caterer(Integer catererId) {
        this.catererId = catererId;
    }

    public Integer getCatererId() {
        return catererId;
    }

    public void setCatererId(Integer catererId) {
        this.catererId = catererId;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Boolean getIsActive() {
        return isActive;
    }

    public void setIsActive(Boolean isActive) {
        this.isActive = isActive;
    }

    public String getDescriptions() {
        return descriptions;
    }

    public void setDescriptions(String descriptions) {
        this.descriptions = descriptions;
    }

    @XmlTransient
    public Collection<Favorite> getFavoriteCollection() {
        return favoriteCollection;
    }

    public void setFavoriteCollection(Collection<Favorite> favoriteCollection) {
        this.favoriteCollection = favoriteCollection;
    }

    @XmlTransient
    public Collection<Restaurant> getRestaurantCollection() {
        return restaurantCollection;
    }

    public void setRestaurantCollection(Collection<Restaurant> restaurantCollection) {
        this.restaurantCollection = restaurantCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (catererId != null ? catererId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caterer)) {
            return false;
        }
        Caterer other = (Caterer) object;
        if ((this.catererId == null && other.catererId != null) || (this.catererId != null && !this.catererId.equals(other.catererId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.entity.Caterer[ catererId=" + catererId + " ]";
    }
    
}
